package com.lwq.model;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * Description:
 * Author: LiuWenQing
 * Datetime: 2021/6/10
 */
@Data
@ApiModel(value="通用返回对象")
public class Result {

    @ApiModelProperty(value="返回code,200成功")
    private String code;
    @ApiModelProperty(value="返回消息")
    private String msg;
    @ApiModelProperty(value="返回值")
    private Object data;

    public static com.lwq.model.Result ok(){
        com.lwq.model.Result r = new com.lwq.model.Result();
        r.setCode("200");
        r.setMsg("操作成功");
        return r;
    }

    public static com.lwq.model.Result error(){
        com.lwq.model.Result r = new com.lwq.model.Result();
        r.setCode("500");
        r.setMsg("操作失败");
        return r;
    }

    public static com.lwq.model.Result error(String msg){
        com.lwq.model.Result r = new com.lwq.model.Result();
        r.setCode("500");
        r.setMsg(msg);
        return r;
    }

    public static com.lwq.model.Result ok(Object o){
        com.lwq.model.Result r = new com.lwq.model.Result();
        r.setCode("200");
        r.setMsg("操作成功");
        r.setData(o);
        return r;
    }

    public static com.lwq.model.Result ok (String msg, Object o){
        com.lwq.model.Result r = new com.lwq.model.Result();
        r.setCode("200");
        r.setMsg(msg);
        r.setData(o);
        return r;
    }

}
